package com.example.zzy.zzytest.controller;

import com.example.zzy.zzytest.config.BizConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.context.refresh.ContextRefresher;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope
@RestController
public class TestController {
    @Autowired
    private BizConfig bizConfig;

    @Autowired
    private ContextRefresher contextRefresher;

    @Value("${biz.refresh}")
    private String refresh;

    @RequestMapping(path = "/show")
    public String show() {
        //String ref = bizConfig.getRefresh();

        System.out.println(refresh);
        return refresh;
    }



    /*@PostMapping(path = "/refresh")
    public String refresh() throws Exception{
        //new Thread( () -> contextRefresher.refresh() ).start();
        return show();
    }*/
}
